<%@page import="News.entity.International_News"%>
<%@page import="News.service.impl.International_NewsServiceImpl"%>
<%@page import="News.service.International_NewsService"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>


<%
	International_NewsService Inser = new International_NewsServiceImpl();
	String opr = request.getParameter("opr");
	if("sel".equals(opr)){
		List<International_News> InterList = Inser.findAllNewsInfo();
		session.setAttribute("InterList", InterList);
		response.sendRedirect("showInternationalNews.jsp ");
	}else if("del".equals(opr)){
		int id =Integer.parseInt(request.getParameter("delid"));
		if(Inser.delNewsById(id)){
			response.sendRedirect("doInternationalNews.jsp?opr=sel");
		}else{
			out.println("删除有误");
		}
	}else if("add".equals(opr)){
		int newsid = Integer.parseInt(request.getParameter("newsid"));
		String newscont = request.getParameter("newscont");
		String newstime = request.getParameter("newstime");
		int newsnor = Integer.parseInt(request.getParameter("newsnor"));
		if(Inser.addNews(newsid, newscont, newstime, newsnor)){
				response.sendRedirect("doInternationalNews.jsp?opr=sel");
			}else{
			out.println("添加失败。");
			}
	}else if("upda".equals(opr)){
		int newsid = Integer.parseInt(request.getParameter("newsid"));
		String newscont = request.getParameter("newscont");
		String newstime = request.getParameter("newstime");
		int newsnor =Integer.parseInt(request.getParameter("newsnor"));
		if(Inser.addNews(newsid, newscont, newstime, newsnor)){
			response.sendRedirect("doInternationalNews.jsp?opr=sel");
			}else{
				out.println("修改错误！");			
			}
	}else{
		out.println("操作错误，请联系管理员");
	}

%>